//
//  ContactTableViewCell.m
//  YZZX
//
//  Created by Easaa on 15/5/6.
//  Copyright (c) 2015年 Easaa. All rights reserved.
//

#import "ContactTableViewCell.h"

#import "MessageComments.h"

@implementation ContactTableViewCell

- (void)awakeFromNib {
    
    
    
    [self.bgView.layer setMasksToBounds:YES];
    [self.bgView.layer setCornerRadius:5]; //设置矩圆角半径
    [self.bgView.layer setBorderWidth:0.5];   //边框宽度
   // CGColorSpaceRef colorSpace =CGColorSpaceCreateDeviceRGB();
    //CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 1, 0, 0, 1 });
    //[self.bgView.layer setBorderColor:colorref];//边框颜色
    
    
    
//    
//    self.NameLable.frame = CGRectMake(100, 10,  (self.bgView.frame.size.width-100)/2-10, 30);
//    
//    self.SiteNameLable.frame =CGRectMake(100+self.NameLable.frame.size.width+10, 10, (self.bgView.frame.size.width-100)/2, 30);
//    
//    self.DescriptionLable.frame =CGRectMake(100, 40, self.bgView.frame.size.width-100, 35);
    
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

  
    
    // Configure the view for the selected state
}

- (IBAction)buttonPhoneFantion:(id)sender {
    
    
    
    UIAlertView  *AlertView = [[UIAlertView alloc]initWithTitle:nil
                                                        message:@"确定要拨打该电话吗？"
                                                       delegate:self
                                              cancelButtonTitle:@"取消"
                                              otherButtonTitles:@"确定", nil];
    
    AlertView.tag = 1024;
    [AlertView show];
    

    //拨打电话
    
    
}


- (IBAction)buttonSmsFantion:(id)sender {

    //给客服发送短信
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"sms://%@",self.Mobile]]];
    
    
}


- (IBAction)buttonMessageFantion:(id)sender {
    
    //给客服留言
    MessageComments  *CommentView =[[MessageComments alloc]initWithViewComment:CGRectMake(0, 0, Dev_ScreenWidth, Dev_ScreenHeight)conmmid:self.id_massge];
    [[UIApplication sharedApplication].keyWindow addSubview:CommentView];
    
    
}

- (IBAction)buttionEmailFantion:(id)sender {
    
    //给客服发邮箱
    
    
    
}



#pragma mark alertView 弹框代理
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    
    if(alertView.tag == 1024)
    {
        if(buttonIndex == 0)
        {
            //取消则不清除缓存
        }else if (buttonIndex == 1)
        {
            //拨打电话
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",self.Mobile]]];
        }
    }
    
}



@end
